package com.ntschy.bt.entity.enums.btpolicyEnum;

import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;

@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum BtPolicyLevelEnum implements IEnum<Integer> {

    /**
     * 政策级别 1-国家级 2-省级 3-市级 4-区级
     * national level ， provincial level ，city level ， district level
     */
    NATIONAL_LEVEL(1, "国家级"),
    PROVINCIAL_LEVEL(2, "省级"),
    CITY_LEVEL(3, "市级"),
    DISTRICT_LEVEL(4, "区级");

    private final int value;

    private final String desc;

    BtPolicyLevelEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Integer getValue() {
        return this.value;
    }

    public String getDesc() {
        return desc;
    }

    @JsonCreator
    public static BtPolicyLevelEnum getBtPolicyLevelEnum(int value) {
        for (BtPolicyLevelEnum companyType : BtPolicyLevelEnum.values()) {
            if(companyType.getValue() == value) {
                return companyType;
            }
        }
        return null;
    }
}
